import request from '@/utils/request'

// 新增管理员
export const addAdminService = (userAddDTO) => {
  return request.post('/admin/user/addAdmin', userAddDTO)
}

// 用户分页查询
export const userPageQueryService = (userPageQueryDTO) => {
  return request.get('/admin/user/page', { params: userPageQueryDTO })
}

// 启用/禁用用户状态
export const updateUserStatusService = (status, id) => {
  return request.post(`/admin/user/status/${status}`, null, { params: { id } })
}

// 根据用户id查询用户信息
export const getUserByIdService = (id) => {
  return request.get(`/admin/user/${id}`)
}

// 修改用户信息
export const updateUserService = (userUpdateDTO) => {
  return request.put('/admin/user', userUpdateDTO)
}

// 删除管理员（不可删除其他类型用户）
export const deleteAdminService = (id) => {
  return request.delete(`/admin/user/${id}`)
}

// 修改用户密码
export const updateUserPasswordService = (password, id) => {
  return request.post(`/admin/user/password/${password}`, null, { params: { id } })
}
